import { If, While, Block, Break, Continue, Return } from './control';
import { Delete, Insert, Select, Update } from './query';
import {
  AlterDatabase,
  AlterFunction,
  AlterProcedure,
  AlterTable,
  AlterView,
  CreateDatabase,
  CreateFunction,
  CreateIndex,
  CreateProcedure,
  CreateSchema,
  CreateSequence,
  CreateTable,
  CreateView,
  DropDatabase,
  DropFunction,
  DropIndex,
  DropProcedure,
  DropSchema,
  DropSequence,
  DropTable,
  DropView,
} from './schema';
import { Assignment, Execute } from './control';
import { VirtualStatement } from './virtual-statement';
import { Annotation } from './annotation';
export * from './query';
export * from './schema';
export * from './virtual-statement';
export * from './control';
export * from './statement';
export * from './annotation';

/**
 * CRUD查询语句
 */
export type QueryStatement = Insert | Update | Select | Delete;

/**
 * 数据库架构操作语句
 */
export type SchemaStatement =
  | CreateDatabase
  | AlterDatabase
  | DropDatabase
  | CreateFunction
  | AlterFunction
  | DropFunction
  | CreateIndex
  | DropIndex
  | CreateProcedure
  | AlterProcedure
  | DropProcedure
  | CreateSequence
  | DropSequence
  | CreateTable
  | AlterTable
  | DropTable
  | CreateView
  | AlterView
  | DropView
  | CreateSchema
  | DropSchema;

export type ControlStatement = If | While | Block | Break | Continue | Return;

/**
 * 单条语句，可直接执行
 */
export type ExecutableStatement =
  | Assignment
  | Execute
  | QueryStatement
  | VirtualStatement
  | SchemaStatement
  | Annotation;

/**
 * 所有的SQL语句
 */
export type XStatement = ExecutableStatement | ControlStatement;
